export const post = (url, data = {}) => {
	return request(url, "POST", data);
};

/**
 * 网络请求
 * @param {String} url 请求地址
 * @param {'GET'|'POST'} method 请求方式
 * @param {Object} data 请求参数
 */
const request = (url, method, data) => {
	return new Promise((resolve, reject) => {
		uni.request({
			url,
			method,
			data,
			success: res => {
				let model = res.res;
				if (model.code == 1) {
					resolve(model);
				}
			}
		})
	})
};

export default {
	post,
}